﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace TheQuest
{
    class Bat : Enemy
    {
        public Bat(Game game, Point location)
            : base(game, location, 6)
        {

        }

        public override void Move(Random random)
        {
            //Only moves as long as it has one or more hit points.
            if (HitPoints >= 1)
            {
                //If it moves, it has a 50% chance that it will either move towards the player or in a random direction.
                if (random.Next(1) == 1)
                {
                    Move(FindPlayerDirection(game.PlayerLocation), game.Boundaries);
                }
                else
                {
                    Move((Direction)random.Next(1, 5), game.Boundaries);
                }

                //If it's near the player...
                if (NearPlayer())
                {
                    //it attacks the player with up to 2 points of damage.
                    game.HitPlayer(2, random);
                }
            }
        }
    }
}
